vpath *.c src
vpath *.h include

WINSDK_VERSION=10.0.20348.0
WINSDK=C:\Program Files (x86)\Windows Kits\10
WINSDK_INCLUDE=${WINSDK}\Include\${WINSDK_VERSION}\um
WINSDK_LIBRARY_x64=${WINSDK}\Lib\${WINSDK_VERSION}\um\x64
WINSDK_LIBRARY_x86=${WINSDK}\Lib\${WINSDK_VERSION}\um\x86

MSVC_ROOT=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822
MSVC_INCLUDE=${MSVC_ROOT}\include

MSVC_BIN_x64=${MSVC_ROOT}\bin\Hostx64\x64
MSVC_BIN_x86=${MSVC_ROOT}\bin\Hostx64\x86
CC_x64=${MSVC_BIN_x64}\cl
CC_x86=${MSVC_BIN_x86}\cl
CFLAGS=/LD /I "${MSVC_INCLUDE}" /I "${WINSDK_INCLUDE}" /I "${WINSDK}\Include\${WINSDK_VERSION}\shared" /I "${WINSDK}\Include\${WINSDK_VERSION}\ucrt"
CFLAGS_x64=${CFLAGS}
CFLAGS_x86=${CFLAGS}
# CFLAGS+=/LIBPATH:lib
OUTPUT_OPTIONS=/Fe:$@
LIBS=User32.lib Gdi32.lib legacy_stdio_definitions.lib uuid.lib libcmt.lib oldnames.lib legacy_stdio_wide_specifiers.lib kernel32.lib
LIBS+=libvcruntime.lib
LIBS+=libucrt.lib
LIBRARIES_x64=$(addprefix lib/x64/,${LIBS})
LIBRARIES_x86=$(addprefix lib/x86/,${LIBS})
MV=echo move
RM=echo del

all: gvimfullscreen.x64.dll gvimfullscreen.x86.dll


# gvimfullscreen.dll: src/gvimfullscreen.c
# 	cl /LD user32.lib Gdi32.lib $<

%.x64.dll : src/%.c
	${CC_x64} ${CFLAGS_x64} ${LIBRARIES_x64} $< ${OUTPUT_OPTIONS}
%.x86.dll : src/%.c
	${CC_x86} ${CFLAGS_x86} ${LIBRARIES_x86} $< ${OUTPUT_OPTIONS}

# clean: 
# 	del *.obj
# 	del *.dll
# 	del *.exp
# 	del *.lib
